#include <stdio.h>
#include <time.h>
#include <stdint.h>
#include <stdint.h>

#include "../mickey_bitslice.h"

#define print_key(key)                  \
{                                       \
   int i;                               \
   printf ("Key               =");      \
   for (i=0; i<10; i++)                 \
      printf (" %02x", key[i]);         \
   printf ("\n");                       \
}                                       \


void example_0(void) {

   int i;

   uint8_t key[10] = {0x3b,0x80,0xfc,0x8c,0x47,0x5f,0xc2,0x70,0xfa,0x26};

   uint8_t keystream_buff[16][MICKEY_NR_STREAMS], *keystream_byte;

   mickey_state ctx;

   /* create context */
   mickey_init(&ctx);

   /* load keys and IVs*/
   mickey_load_key(&ctx,key); mickey_load_IV(&ctx,NULL,0);
   print_key(key);

   /* do the actual key loading and initialization */
   mickey_setup(&ctx);

   /* generate keystream */
   for(i=0;i<16;i++) {
      keystream_byte=keystream_buff[i];
      mickey_keystream_byte(&ctx,keystream_byte);
   }

   printf ("Keystream         =");
   for(i=0;i<16;i++) {
      printf(" %02x",keystream_buff[i][0]);
   }
   printf("\n");
}

int main(void) {
   example_0();
   return 0;
}
